Skip to content

Update receptionist opening line to Jess script#4

Merged
WebCraftPhil merged 1 commit into
mainfrom
codex/update-opening-line-for-booking-script
Apr 4, 2026
Merged

Update receptionist opening line to Jess script#4
WebCraftPhil merged 1 commit into
mainfrom
codex/update-opening-line-for-booking-script

Conversation

@WebCraftPhil

@WebCraftPhil WebCraftPhil commented Apr 4, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Change the agent's spoken first-turn greeting to the exact wording requested: a caller-led Downtown Demo Barbershop / Jess script that offers booking or availability checks.

Description

  • Replace the “first turn must be exactly…” instruction in build_reception_instructions() with the new fixed greeting: "Downtown Demo Barbershop, this is Jess— I can help you get booked or check what we have open. What are you looking to come in for today?".
  • Update the runtime opening utterance in agent_session (session.say(...)) to emit the new Jess greeting verbatim.
  • Adjust the opening-line evaluation in tests/test_agent.py so the test intent expects the new caller-led greeting phrasing.

Testing

  • Ran formatter and linter with uv run ruff format and uv run ruff check, and those checks passed.
  • Ran the test suite with uv run pytest; test execution failed due to external inference connectivity errors (httpx.ProxyError: 403 Forbidden) causing LLM-backed tests to time out or error, resulting in 1 passed, 11 failed.
  • Manual verification: the modified files were updated and formatted as expected; failures are environmental (LiveKit/OpenAI inference proxy) rather than assertion failures against the local code changes.

Codex Task

Summary by Sourcery

Update the receptionist agent’s scripted opening line to a fixed Jess-specific greeting and align runtime behavior and tests with the new phrasing.

Enhancements:

  • Standardize the receptionist greeting in the agent instructions and runtime opening utterance to a specific Downtown Demo Barbershop Jess script.

Tests:

  • Adjust the caller-led opening line test expectations to match the new fixed Jess greeting wording.

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved the AI assistant's initial greeting to be more personalized and conversational, reducing scripted language and better guiding callers through the booking process.
  • Tests

    • Updated test expectations to align with the new greeting behavior.

Copilot AI review requested due to automatic review settings April 4, 2026 21:00
@sourcery-ai

sourcery-ai Bot commented Apr 4, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the receptionist agent’s opening greeting to a fixed Jess-specific Downtown Demo Barbershop script and aligns runtime behavior and tests with that exact wording.

Sequence diagram for updated receptionist opening greeting behavior

sequenceDiagram
    actor Caller
    participant ReceptionAgent

    Caller->>ReceptionAgent: Incoming_call()
    activate ReceptionAgent
    ReceptionAgent->>ReceptionAgent: agent_session_start
    ReceptionAgent->>Caller: Downtown Demo Barbershop, this is Jess— I can help you get booked or check what we have open. What are you looking to come in for today?
    Caller->>ReceptionAgent: Describe_reason_for_call
    ReceptionAgent->>ReceptionAgent: Follow_call_flow_rules
    ReceptionAgent->>Caller: Provide_helpful_response
    deactivate ReceptionAgent
Loading

File-Level Changes

Change Details Files
Hard-code the first-turn greeting in reception instructions to the new Jess/Downtown Demo Barbershop script.
  • Replace the previous parameterized first-turn instruction with a literal, fixed greeting string matching the requested wording.
  • Keep all other reception call-flow rules intact.
src/agent.py
Emit the new Jess greeting verbatim at agent session startup instead of building it from business profile data.
  • Remove use of BUSINESS_PROFILE-derived business_name for the initial spoken line.
  • Update session.say(...) to use the exact multi-line Jess greeting string, matching the instruction text.
src/agent.py
Align the caller-led opening-line test with the new exact greeting and tone requirements.
  • Change the LLM judge intent text to expect the specific Jess greeting wording instead of generic examples.
  • Adjust phrasing expectations to emphasize the full caller-led script while still requiring a conversational tone.
tests/test_agent.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Apr 4, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 54b8f701-dc84-4f3a-9ba5-abcc5973f90d

📥 Commits

Reviewing files that changed from the base of the PR and between 49e4819 and a9bf4b9.

📒 Files selected for processing (2)
  • src/agent.py
  • tests/test_agent.py

📝 Walkthrough

Walkthrough

The changes hardcode a specific greeting phrase and persona ("Downtown Demo Barbershop, this is Jess") into both the agent's initial instructions and session startup, replacing the previous dynamic template system that used configurable business_name and ASSISTANT_NAME values.

Changes

Cohort / File(s) Summary
Agent greeting hardcoding
src/agent.py
Replaced dynamic greeting construction using business_name and ASSISTANT_NAME template variables with fixed "Downtown Demo Barbershop, this is Jess—" phrase in both build_reception_instructions() and agent_session(). Removed runtime business_name construction.
Test expectation updates
tests/test_agent.py
Updated test_uses_caller_led_opening_line expectations to match the new hardcoded greeting format and adjusted naturalness criteria from "not scripted or robotic" to "stay natural and conversational."

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A barbershop named Downtown Demo is fine,
Jess's greeting now carved in every line—
No more templates swapping names around,
Just one fixed hello, forever bound!
✂️✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/update-opening-line-for-booking-script

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The greeting string is now hard-coded in both build_reception_instructions() and agent_session() (and echoed in tests); consider centralizing this text in a single constant or helper to avoid divergence if it changes again.
  • By removing the business_name/ASSISTANT_NAME interpolation, the opening line is no longer driven by the business profile configuration; if this behavior is intended only for this demo, it may be clearer to keep configurability and apply the Jess script as a template using those values.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The greeting string is now hard-coded in both `build_reception_instructions()` and `agent_session()` (and echoed in tests); consider centralizing this text in a single constant or helper to avoid divergence if it changes again.
- By removing the `business_name`/`ASSISTANT_NAME` interpolation, the opening line is no longer driven by the business profile configuration; if this behavior is intended only for this demo, it may be clearer to keep configurability and apply the Jess script as a template using those values.

## Individual Comments

### Comment 1
<location path="src/agent.py" line_range="303-306" />
<code_context>
         ),
     )

-    business_name = str(
-        BUSINESS_PROFILE.get("business_name", "Downtown Demo Barber Shop")
-    )
     await session.say(
-        f"This is {business_name}, {ASSISTANT_NAME} speaking. How can I help?"
+        "Downtown Demo Barbershop, this is Jess— "
+        "I can help you get booked or check what we have open. "
+        "What are you looking to come in for today?"
     )

</code_context>
<issue_to_address>
**suggestion:** Duplicated, hard-coded greeting string in `agent_session` can drift from the instruction text

The first-turn utterance is defined both in `build_reception_instructions` and here in `agent_session`. That duplication makes it easy for the spoken greeting to drift from the instructions over time. Consider pulling this text from a shared constant or helper so the model’s instructions and the actual opening line always stay in sync.

Suggested implementation:

```python
        "\n\n"
        "Call flow rules:\n"
        f"1) First turn must be exactly: '{FIRST_TURN_GREETING}'\n"
        "2) Be helpful first: answer the caller's question directly before suggesting any next step.\n"
        "3) Do not pressure, upsell, or repeatedly circle back to appointments. Only mention booking when the caller asks to book or when it genuinely helps answer their question.\n"
        "4) If the caller interrupts, changes the subject, or asks a new question, stop the current response immediately in your next turn, answer the new request, and drop any unfinished booking script.\n"
        ),
    )


    await session.say(FIRST_TURN_GREETING)

```

To complete the refactor and avoid duplication, you should also:
1. Define a shared constant at module level (near other configuration/constants), for example:
   `FIRST_TURN_GREETING = "Downtown Demo Barbershop, this is Jess— I can help you get booked or check what we have open. What are you looking to come in for today?"`
2. Ensure there are no other hard-coded copies of this greeting elsewhere; update them to use `FIRST_TURN_GREETING` as well if they exist.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/agent.py
Comment on lines -303 to 306
business_name = str(
BUSINESS_PROFILE.get("business_name", "Downtown Demo Barber Shop")
)
await session.say(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Duplicated, hard-coded greeting string in agent_session can drift from the instruction text

The first-turn utterance is defined both in build_reception_instructions and here in agent_session. That duplication makes it easy for the spoken greeting to drift from the instructions over time. Consider pulling this text from a shared constant or helper so the model’s instructions and the actual opening line always stay in sync.

Suggested implementation:

        "\n\n"
        "Call flow rules:\n"
        f"1) First turn must be exactly: '{FIRST_TURN_GREETING}'\n"
        "2) Be helpful first: answer the caller's question directly before suggesting any next step.\n"
        "3) Do not pressure, upsell, or repeatedly circle back to appointments. Only mention booking when the caller asks to book or when it genuinely helps answer their question.\n"
        "4) If the caller interrupts, changes the subject, or asks a new question, stop the current response immediately in your next turn, answer the new request, and drop any unfinished booking script.\n"
        ),
    )


    await session.say(FIRST_TURN_GREETING)

To complete the refactor and avoid duplication, you should also:

  1. Define a shared constant at module level (near other configuration/constants), for example:
    FIRST_TURN_GREETING = "Downtown Demo Barbershop, this is Jess— I can help you get booked or check what we have open. What are you looking to come in for today?"
  2. Ensure there are no other hard-coded copies of this greeting elsewhere; update them to use FIRST_TURN_GREETING as well if they exist.

@WebCraftPhil WebCraftPhil merged commit 76936ed into main Apr 4, 2026
5 of 6 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the receptionist agent’s first-turn greeting to a specific “Downtown Demo Barbershop / Jess” caller-led script, ensuring both the prompt instructions and the runtime opening utterance reflect the requested wording.

Changes:

  • Updated build_reception_instructions() to require the new fixed Jess greeting as the first turn.
  • Updated agent_session to session.say(...) the new greeting verbatim on session start.
  • Adjusted the opening-line evaluation intent in tests/test_agent.py to match the new phrasing.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/agent.py Hardcodes the new opening greeting in both the prompt “first turn must be exactly” rule and the runtime session.say(...).
tests/test_agent.py Updates the LLM-judged intent text to expect the new caller-led greeting content.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/agent.py
"\n\n"
"Call flow rules:\n"
f"1) First turn must be exactly: 'This is {business_name}, {ASSISTANT_NAME} speaking. How can I help?'\n"
"1) First turn must be exactly: 'Downtown Demo Barbershop, this is Jess— I can help you get booked or check what we have open. What are you looking to come in for today?'\n"

Copilot AI Apr 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prompt now hardcodes a first-turn greeting with “Downtown Demo Barbershop” and “Jess”, but elsewhere in the same instructions the agent identity still uses the configurable BUSINESS_PROFILE business_name and ASSISTANT_NAME (defaulting to “Downtown Demo Barber Shop” / “Jessica”). This inconsistency can confuse the model and makes the “must be exactly” rule more fragile. Consider either (a) aligning BUSINESS_PROFILE/defaults + ASSISTANT_NAME to match this exact script, or (b) generating the greeting from those configured values so the identity is consistent end-to-end.

Suggested change
"1) First turn must be exactly: 'Downtown Demo Barbershop, this is Jess— I can help you get booked or check what we have open. What are you looking to come in for today?'\n"
f"1) First turn must be exactly: '{business_name}, this is {ASSISTANT_NAME}— I can help you get booked or check what we have open. What are you looking to come in for today?'\n"

Copilot uses AI. Check for mistakes.
Comment thread src/agent.py
Comment on lines 303 to +306
await session.say(
f"This is {business_name}, {ASSISTANT_NAME} speaking. How can I help?"
"Downtown Demo Barbershop, this is Jess— "
"I can help you get booked or check what we have open. "
"What are you looking to come in for today?"

Copilot AI Apr 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The opening greeting string is duplicated (here and in build_reception_instructions). Keeping two copies increases the risk that runtime behavior and prompt/tests drift over time. Recommend defining a single constant (e.g., OPENING_GREETING) and reusing it for both the prompt and session.say (and optionally for the test intent text as well).

Copilot uses AI. Check for mistakes.
Comment thread tests/test_agent.py
Comment on lines +160 to +162
Uses this caller-led opening greeting:
- "Downtown Demo Barbershop, this is Jess—"
- "I can help you get booked or check what we have open. What are you looking to come in for today?"

Copilot AI Apr 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This intent description doesn’t explicitly require the greeting verbatim (including punctuation/spacing), and splitting the quote across two bullet lines (ending the first with an em dash) makes the requirement a bit ambiguous for the LLM judge. To better enforce the PR’s “exact wording” goal, consider stating the full greeting as a single quoted line and explicitly calling out “verbatim / exact text”.

Suggested change
Uses this caller-led opening greeting:
- "Downtown Demo Barbershop, this is Jess—"
- "I can help you get booked or check what we have open. What are you looking to come in for today?"
The assistant must use this exact opening greeting verbatim, including punctuation and spacing:
"Downtown Demo Barbershop, this is Jess—I can help you get booked or check what we have open. What are you looking to come in for today?"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants